
<style type="text/css">
        .wrapper{
            width: 200px;
            margin: 30px auto;
        }
        input.error{
            border: 1px solid #a10;
        }
        .error{

            color: #a10;
        }
        /*p.error{
            display: none;
        }*/
</style>
<div class="bg-light lter b-b wrapper-md">
    <h1 class="m-n font-thin h3">
        红包产品创建
    </h1>
</div>
<div class="wrapper-md">
    <div class="panel panel-default">
        <div class="panel-heading font-bold">
            红包产品基本信息
        </div>
        <div class="panel-body">
            <form class="form-horizontal form-validation" color="white" name="signUpForm" ng-submit="submit()" >
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        *名称：
                    </label>
                    <div class="col-sm-5">
                        <input class="form-control" ng-model="redpacket.name" type="text" name="name"   ng-maxlength="32" ng-focus="redpacket.nameadd()" ng-blur="redpacket.nameblur()"/><!--ng-minlength="4"-->
                    </div>
                    <!--验证信息-->
                    <label class="col-sm-5 control-label">
                        <div ng-show="redpacket.namecheck" align="left">
                            <span class="error">红包产品名不能为空</span>
                        </div>
                    </label>
                    <div class="line line-dashed b-b line-lg pull-in">
                    </div>
                </div>
                <!--下拉列表-->
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        红包类型：
                    </label>
                    <div class="col-sm-2">
                        <div style="width: 160px">
                            <ui-select ng-model="redpacket.type" theme="bootstrap"
                                on-select="onSelect($item, $model)"
                                >
                                <ui-select-match >
                                    {{$select.selected.sys_type}}
                                </ui-select-match>
                                <ui-select-choices 
                                repeat="item.code as item in redpacket.types | filter: $select.search">
                                    <span ng-bind-html="item.sys_type | highlight: $select.search"></span>
                                </ui-select-choices>
                            </ui-select>
                       </div>
                    </div>
                    <label class="col-sm-3 control-label">
                            <div ng-show="redpacket.redtype" align="right" style="padding-left: 0px">
                                <span class="error">请选择红包类型</span>
                            </div>
                    </label>
                </div>
                <div class="line line-dashed b-b line-lg pull-in">
                </div>               
                <!--并列单选按钮-->
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        *红包规则：
                    </label>
                    <div class="col-sm-10">
                        <label class="i-checks checkbox-inline">
                            <input name="redpacket_rule" ng-model="redpacket.rule" type="radio" value="n01" ng-click="redpacket.showrule()">
                                <i>
                                </i>
                                定额红包
                        </label>
                        <label class="i-checks checkbox-inline">
                            <input name="redpacket_rule" ng-model="redpacket.rule" type="radio" value="n02" ng-click="redpacket.showrule()">
                                <i>
                                </i>
                                随机红包
                        </label>
                        <label class="i-checks checkbox-inline">
                            <input name="redpacket_rule" ng-model="redpacket.rule" type="radio" value="n03" ng-click="redpacket.showrule()">
                                <i>
                                </i>
                                消费金额百分比红包
                        </label>
                    </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in">
                </div>
                <!--红包输入金额-->
                <div ng-if="redpacket.quotamoney">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">
                            定额红包金额：
                        </label>
                        <div class="col-sm-2">
                            <input class="form-control" ng-model="redpacket.normal_redmoney" type="number" style="width:100px" min="0" ng-blur="redpacket.normal_redmoneyblur()" ng-focus="redpacket.normal_redmoneyadd()"/><!--ng-minlength="4"-->
                        </div>
                        <!--验证信息-->
                        <!--ng-focus="redpacket.normal_redmoneyadd()" ng-blur="redpacket.normal_redmoneyblur()"-->
                            <label class="col-sm-3 control-label">
                            <div ng-show="redpacket.normal_redmoneycheck" align="left" style="padding-left: 0px">
                                <span class="error">定额红包金额名不能为空或为0</span>
                            </div>
                            </label>
                        <div class="line line-dashed b-b line-lg pull-in">
                        </div>
                    </div>  
                </div>
                <div ng-if="redpacket.randommoney">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                随机红包金额：
                            </label>
                            <div class="col-sm-10" style="text-align: left">
                                <label class="col-sm-2 control-label" style="text-align: left;width: 100px">
                                    最小金额：
                                </label>
                                <div class="col-sm-3" style="padding: 0;width:100px">
                                    <input class="form-control" ng-model="redpacket.random_redmoney_start" type="number"  min="0" ng-blur="redpacket.random_redmoneyblur()" ng-focus="redpacket.random_redmoneyadd()"/>
                                </div>
                                <label class="col-sm-2 control-label" style="text-align: left;width: 100px">
                                    最大金额：
                                </label>
                                <div class="col-sm-3" style="padding: 0;width:100px">
                                    <input class="form-control" ng-model="redpacket.random_redmoney_end" type="number" min="0" ng-blur="redpacket.random_redmoneyblur()" ng-focus="redpacket.random_redmoneyadd()"/>
                                </div>
                                <label class="col-sm-3 control-label">
                                <div ng-show="redpacket.random_redmoneycheck" align="left" style="padding-left: 0px">
                                    <span class="error">随机红包金额名不能为空或为0</span>
                                </div>
                                </label>
                            </div>
                        </div>                           
                        <div class="line line-dashed b-b line-lg pull-in">
                        </div>
                </div>
               <div ng-if="redpacket.percentmoney"> 
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        消费金额百分比：
                    </label>
                    <div class="col-sm-2" style="width: 120px">
                        <input class="form-control" ng-model="redpacket.consume_redmoney" type="number" style="width: 100px" min="0" max="100" ng-blur="redpacket.consume_redmoneyblur()" ng-focus="redpacket.consume_redmoneyadd()"/><!--ng-minlength="4"-->
                    </div>
                    <label class="col-sm-2 control-label" style="padding-left:0px; text-align:left" >
                        %
                    </label>
                    <label class="col-sm-3 control-label">
                        <div ng-show="redpacket.consume_redmoneycheck" align="left" style="padding-left: 0px">
                            <span class="error">红包百分比不能为空且需要大于0小于100</span>
                        </div>
                    </label>
                    <div class="line line-dashed b-b line-lg pull-in">
                    </div>
                </div>
              </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        红包发放类型：
                    </label>
                    <div class="col-sm-10">
                        <label class="i-checks checkbox-inline">
                            <input name="rp_type" ng-model="redpacket.rp_type" type="radio" value="01">
                                <i>
                                </i>
                                发放
                        </label>
                        <label class="i-checks checkbox-inline">
                            <input name="rp_type" ng-model="redpacket.rp_type" type="radio" value="02">
                                <i>
                                </i>
                                自行领取
                        </label>
                    </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in">
                </div>
                <!--库存类型-->
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        库存类型：
                    </label>
                    <div class="col-sm-10">
                        <label class="i-checks checkbox-inline">
                            <input name="stock_type" ng-model="redpacket.stock_type" type="radio" value="0" ng-click="redpacket.showstocknum()">
                                <i>
                                </i>
                                不启用
                        </label>
                        <label class="i-checks checkbox-inline">
                            <input name="stock_type" ng-model="redpacket.stock_type" type="radio" value="1" ng-click="redpacket.showstocknum()">
                                <i>
                                </i>
                                启用
                        </label>
                    </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in">
                </div>
                
                <!--库存数量-->
                <div ng-if="redpacket.stocknumshow">
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        库存数量：
                    </label>
                    <div class="col-sm-2">
                        <input class="form-control" ng-model="redpacket.stock_num" type="number" style="width:100px" min="0" ng-blur="redpacket.stock_numblur()" ng-focus="redpacket.stock_numadd()"/><!--ng-minlength="4"-->
                    </div>
                    <label class="col-sm-3 control-label">
                        <div ng-show="redpacket.stock_numcheck" align="left" style="padding-left: 0px">
                            <span class="error">库存数量不能为空或为0</span>
                        </div>
                    </label>
                    <div class="line line-dashed b-b line-lg pull-in">
                    </div>
                </div>
                </div>
                <!--最大数量限制-->
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        是否限制数量：
                    </label>
                    <div class="col-sm-10">
                        <label class="i-checks checkbox-inline">
                            <input name="max_limit" ng-model="redpacket.max_limit" type="radio" value="-1" ng-click="redpacket.maxlimitshow()">
                                <i>
                                </i>
                                不限制
                        </label>
                        <label class="i-checks checkbox-inline">
                            <input name="max_limit" ng-model="redpacket.max_limit" type="radio" value="0" ng-click="redpacket.maxlimitshow()">
                                <i>
                                </i>
                                限制
                        </label>
                    </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in">
                </div>
                <!--限制数量-->
                <div ng-if="redpacket.showmaxlimit">
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        最大限制数量：
                    </label>
                    <div class="col-sm-2">
                        <input class="form-control" ng-model="redpacket.max_limit_num" type="number" style="width:100px" min="0" ng-blur="redpacket.max_limit_numblur()" ng-focus="redpacket.max_limit_numadd()"/><!--ng-minlength="4"-->
                    </div>
                    <label class="col-sm-3 control-label">
                        <div ng-show="redpacket.max_limit_numcheck" align="left" style="padding-left: 0px">
                            <span class="error">最大限制数量不能为空或为0</span>
                        </div>
                    </label>
                    <div class="line line-dashed b-b line-lg pull-in">
                    </div>
                </div>
                </div>
                <!--备注-->
                 <div class="form-group">
                    <label class="col-sm-2 control-label">
                        备注：
                    </label>
                    <div class="col-sm-7">
                        <textarea class="form-control" ng-model="redpacket.remarks" rows="3">
                        </textarea>
                    </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in">
                </div>
                <!--保存-->
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                    </label>
                    <div class="col-sm-10">
                        <button class="btn m-b-xs w-xs btn-primary mr10" ng-click="submit()" type="button">
                            保存
                        </button>
                    </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in">
                </div>
            </form>
        </div>
    </div>
</div>